home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / wdj0797.zip / TUFFS.ZIP / EXCEPT1.CPP next >
C/C++ Source or Header  |  1997-04-24  |  464b  |  21 lines

  1. #include <iostream.h>
  2. #include <stdexcep.h>
  3. #include <cstring.h>
  4.  
  5. void badFunction(){
  6.   throw xmsg("badFunction exception");
  7. }
  8. int main(){
  9.   try  {
  10.     cout << "Calling badFunction()" << endl;
  11.     badFunction();
  12.     cout << "badFunction() completed without exception" << endl;
  13.   } catch (xmsg &x) {
  14.     cerr << "Exception caught '" << x.why() << "'" << endl;
  15.   } catch (...) {
  16.     cerr << "Unknown exception caught" << endl;
  17.   }
  18.   return 0;
  19. }
  20.  
  21.